<?php

/**
 * This is the model class for table "{{transfer_index}}".
 *
 * The followings are the available columns in table '{{transfer_index}}':
 * @property string $id
 * @property integer $transfer_id
 * @property string $action_unique_id
 * @property integer $index
 * @property string $action
 * @property integer $dateline
 */
class TransferIndex extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TransferIndex the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{transfer_index}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('transfer_id', 'required'),
			array('transfer_id, t_index, dateline', 'numerical', 'integerOnly'=>true),
			array('action_unique_id', 'length', 'max'=>64),
			//array('length', 'max'=>255),
			//array('note'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, transfer_id, action_unique_id, t_index, action_type, note, dateline', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'transfer_id' => 'Transfer',
			'action_unique_id' => 'Action Unique',
			't_index' => 'Index',
			'action_type' => 'Action Type',
			'note' => 'Note',
			'dateline' => 'Dateline',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('transfer_id',$this->transfer_id);
		$criteria->compare('action_unique_id',$this->action_unique_id,true);
		$criteria->compare('t_index',$this->t_index);
		$criteria->compare('action_type',$this->action_type);
		$criteria->compare('note',$this->note);
		$criteria->compare('dateline',$this->dateline);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}